<?php
namespace Admin\Controller;
use Think\Controller;
class InfoController extends Controller {
    public $info;
    public function __construct() {
    	parent::__construct();
        $this->info = M('info');
    }

    public function add_info() {
        $infonow = $this->info->field('neirong')->where('id=2')->select();
        $this->assign('info',$infonow);
        $time=time();
        $date=date("Y-m-d H:i:d",$time);
        $this->assign('time',$date);  
         $this->display();
    }

    public function ad_info() {
      if($_POST['info']) {
            $info =$_POST['info'];
            $time = $_POST['time'];
        
            $arr = array('neirong'=>$info,'time'=>$time);
            $a  = $this->info->where('id=2')->save($arr);
        }
        if($a) {
            $this->success('发布消息成功','add_info');
        } else {
             $this->error('发布消息失败','add_info');
        }
        
        
 
    }
}
